package com.tm;

import java.util.Scanner;

public class Demo28 {
    public static void main(String[] args) {
        //目标：掌握定义方法的完整格式，搞清楚使用方法的好处
        //需求：假如现在很多程序员都要进行2个整数求和的操作

        //1.李工
  /*      double a=10;
        double b=20;
        double c=a+b;
        System.out.prdoubleln(c);
*/
        double[] arr={5.7,6.7,7.7,2.7};
        double avg=0;
        for (int i = 0; i < arr.length; i++) {
               avg+=arr[i];
        }
       System.out.println(avg/arr.length);
        double[] num= new double[4];
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < num.length; i++) {
            System.out.println("请输入当前第"+(i+1)+"数:");
            double i1 = scanner.nextDouble();
            num[i]=i1;
        }
        double avg1=0;
        for (int i = 0; i <num.length ; i++) {
            avg1+=num[i];
        }
        System.out.println(avg1/num.length);
    }


}
